package com.twu.biblioteca;

/**
 * Created by sravanns on 17/06/14.
 */
public class Logout implements MenuAction {

    private UserInterface UIApplication;

    public Logout(Library lib, UserInterface ui) {

        UIApplication =ui;
    }

    @Override
    public String toString() {
        return "Logout";
    }

    @Override
    public Result performAction(String user) throws InterruptedException {
        UIApplication.display("Confirm quiting YES or NO");
        Result result=new Result();
        if(UIApplication.acceptTitle().equalsIgnoreCase("yes")) {
            throw new InterruptedException();

        }
        else {
            result.setResult("failed to logout",false);

            return result;
        }
    }
}
